import axios from '@/libs/api.request'

export const roleIndexData = (params) => {
  return axios.request({
    url: '/system/role',
    method: 'get',
    params
  })
}

/**
 * 添加角色
 * @param data
 * @returns {*}
 */
export const roleAdd = (data) => {
  return axios.request({
    url: '/system/role/add',
    method: 'post',
    data
  })
}

/**
 * 修改角色数据
 * @param data
 * @returns {*}
 */
export const roleUpdateData = (data) => {
  return axios.request({
    url: '/system/role/updateData',
    method: 'post',
    data
  })
}

/**
 * 修改角色状态
 * @param data
 * @returns {*}
 */
export const roleUpdateStatus = (data) => {
  return axios.request({
    url: '/system/role/updateStatus',
    method: 'post',
    data
  })
}

/**
 * 删除角色
 * @param data
 * @returns {*}
 */
export const roleDelete = (data) => {
  return axios.request({
    url: '/system/role/delete',
    method: 'delete',
    data
  })
}

export const roleRights = (params) => {
  return axios.request({
    url: '/system/role/rights',
    method: 'get',
    params
  })
}

/**
 * 角色权限更新
 * @param data
 * @returns {*}
 */
export const roleRightsUpdate = (data) => {
  return axios.request({
    url: '/system/role/rightsUpdate',
    method: 'post',
    data
  })
}
